﻿using Library.Common.Encrypt;
using Library.Core.Domain.Aggregation;

namespace Synthesize.BaseSet.Domain.Aggregation.Entity.Authority
{
    /// <summary>
    /// 用户表信息
    /// </summary>
    public class UserInfoEntity:AggregateRoot
    {
        const string _userDefaultPassword = "sms100";

        /// <summary>
        /// 用户名【登录名】
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 用户描述
        /// </summary>
        public string UserDescribe { get; set; }
        /// <summary>
        /// 用户电话
        /// </summary>
        public string Telphone { get; set; }
        /// <summary>
        /// 排序编号
        /// </summary>
        public double Sort { get; set; }
        /// <summary>
        /// 性别 男 女
        /// </summary>
        public string Gender { get; set; }
        /// <summary>
        /// 用户昵称
        /// </summary>
        public string NickName { get; set; }

        /// <summary>
        /// 用户真实名
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 用户头像地址
        /// </summary>
        public string PictureUrl { get; set; }

        /// <summary>
        /// 是否有效
        /// </summary>
        public bool IsValid { get; set; }

        /// <summary>
        /// 是否是超级管理员
        /// </summary>
        public bool IsSuperUser { get; set; }

        /// <summary>
        /// 重置密码
        /// </summary>
        public void ResetPassword()
        {
            Password = SecurityHelper.GetMD5Hash(SecurityHelper.GetMD5Hash(_userDefaultPassword));
        }
    }
}
